package org.layuiframework.generator.engine.impl;

import org.layuiframework.generator.config.po.LayuiTableField;
import org.layuiframework.generator.engine.TableFieldConverter;

public class TableFieldConvertTime implements TableFieldConverter {

    @Override
    public boolean canDeal(String comment) {
        return "time".equals(comment.toLowerCase());
    }

    @Override
    public LayuiTableField deal(LayuiTableField layuiTableField, String comment) {
        layuiTableField.setTimeColumn(true);
        // 去掉注释里面的time
        layuiTableField.setComment(layuiTableField.getComment().substring(0, layuiTableField.getComment().lastIndexOf("(")));
        return layuiTableField;
    }
}
